manifest {
    mainScript = 'ribap.nf'
    nextflowVersion = '>=20.01.0'
}

// default parameters
params {
  max_cores = Runtime.runtime.availableProcessors()
  cores = '4'
  memory = '8.GB'
  help = false
  profile = false

  // input
  fasta = ''
  list = false

  // parameters
  gcode = 0
  reference = false
  heigth = 8
  width = 10
  tree = false
  bootstrap = 1000
  core_perc = 1.0
  sets = false
  tmlim = 240 // ILP solve time limit in seconds
  chunks = 8 // how many ILP chunks for parallel computing
  protein_fasta_file = ''
  annotation_file = ''
  set_recursion_limit = 1000

  // folder structure
  output = 'results'

  // per default we remove ILP intermediate files to save disk space 
  keepILPs = false

  // optional profile configurations, only necessary for HPC LSF execution
  cloudProcess = false

  // location for storing the conda environments
  condaCacheDir = 'conda'
  // location for storing the singularity images
  singularityCacheDir = 'singularity'

}

profiles {

    // executors
    local {
        executor {
            name = "local"
            cpus = params.max_cores
            memory = params.memory
        }
        params.cloudProcess = false
        includeConfig 'configs/local.config'
    }

    slurm {
        executor {
            name = "slurm"
            queueSize = 100
            // exitReadTimeout = "360 sec"
            // submitRateLimit = '1 / 2 s'
            // pollInterval = '30 sec'
        }
        params.cloudProcess = true
        process {
            clusterOptions = '--time=72:00:00'
            cache = "lenient"
        }
        includeConfig 'configs/nodes.config'
    }

    lsf {
        executor {
            name = "lsf"
            queueSize = 100
            // exitReadTimeout = "360 sec"
            // submitRateLimit = '1 / 2 s'
            // pollInterval = '30 sec'
        }
        params.cloudProcess = true
        process.cache = "lenient"
        includeConfig 'configs/nodes.config'
    }

    // engines 
    conda {
        conda{ 
            enabled = true
            cacheDir = params.condaCacheDir
            timeout = '45 min'
            
        }
        includeConfig 'configs/conda.config'
    }

    mamba{
        conda{
            enabled = true
            cacheDir = params.condaCacheDir
            timeout = '45 min'
            useMamba = true
        }
        includeConfig 'configs/conda.config'
    }

    docker {
        docker { 
            enabled = true
        }
        includeConfig 'configs/container.config'
    }

    singularity {
        singularity { 
                enabled = true
                autoMounts = true
                envWhitelist = "HTTPS_PROXY,HTTP_PROXY,http_proxy,https_proxy,FTP_PROXY,ftp_proxy"
                cacheDir = params.singularityCacheDir
        }
        includeConfig 'configs/container.config'
    }


    // predefined combinations

    // local execution with conda
    standard {
        executor {
            name = "local"
            cpus = params.max_cores
            memory = params.memory
        }
        params.cloudProcess = false
        conda { cacheDir = params.condaCacheDir }
        includeConfig 'configs/local.config'
        includeConfig 'configs/conda.config' 
    }

}
